package newcoder;

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int m = sc.nextInt();
        long max = 0;
        int count =0;
        int[] w= new int[n];
        for(int i = 0;i<n;++i){
            w[i] = sc.nextInt();
            if(w[i]<=m)count++;
        }
        if(k==0||count==w.length){
            for(int num :w) max+=num;
            System.out.println(max);
            return;
        }
        Arrays.sort(w);

        if(n%(k+1)==0){
            for(int i=1;i<=n/(k+1)&&i<=n-count;++i){
                long curmax =0;
                int v =n-1;
                for(int j =0;j<i;j++){
                    curmax+=w[v--];
                }
                int count1=count;
                for(int j=0;j<n-(i-1)*(k+1)-1;++j){
                    if(count1==0) break;
                    curmax+=w[--count1];
                }
                max = Math.max(max,curmax);
            }
        }else{
            for(int i=1;i<=n/(k+1)+1&&i<=n-count;++i){
                long curmax =0;
                int v =n-1;
                for(int j =0;j<i;j++){
                    curmax+=w[v--];
                }
                int count2=count;
                for(int j=0;j<n-(i-1)*(k+1)-1;++j){
                    if(count2==0) break;
                    curmax+=w[--count2];
                }
                max = Math.max(max,curmax);
            }
        }
        System.out.println(max);
    }
}
